package com.aiyige.page.my.order.model;

import android.text.TextUtils;

public class RefundReasonModel {
    public final static String RESPONSIBLE_PARTY_BUYER = "buyer";
    public final static String RESPONSIBLE_PARTY_SELLER = "seller";
    String id;
    String title;
    boolean selected;
    String personLiable;//责任方-buyer 买家责任，seller 卖家责任
    String userFeeSummary;//手续费简介，例如：卖家承担手续费
    String userFeeDetail;//手续费简介弹窗，例如：因为买家选择的退款理由为“{0}”所以由卖家承担第三方
    String refundFeeDetail;//卖家承担责任时，弹窗用，例如：您发布的线下课程 《{0}》因为卖家的原因导致退款，您还需支付第三方支付平台产生的手续费用¥{1}哦~

    /**
     * 卖家支付手续费
     * @return
     */
    public boolean isSellerPay() {
        return !TextUtils.isDigitsOnly(personLiable) && personLiable.equals(RESPONSIBLE_PARTY_SELLER);
    }

    /**
     * 买家支付手续费
     * @return
     */
    public boolean isBuyerPay() {
        return !TextUtils.isDigitsOnly(personLiable) && personLiable.equals(RESPONSIBLE_PARTY_BUYER);
    }
    public RefundReasonModel() {

    }

    private RefundReasonModel(Builder builder) {
        setId(builder.id);
        setTitle(builder.title);
        setSelected(builder.selected);
        setPersonLiable(builder.personLiable);
        setUserFeeSummary(builder.userFeeSummary);
        setUserFeeDetail(builder.userFeeDetail);
        setRefundFeeDetail(builder.refundFeeDetail);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }


    public String getPersonLiable() {
        return personLiable;
    }

    public void setPersonLiable(String personLiable) {
        this.personLiable = personLiable;
    }

    public String getUserFeeSummary() {
        return userFeeSummary == null ? "":userFeeSummary;
    }

    public void setUserFeeSummary(String userFeeSummary) {
        this.userFeeSummary = userFeeSummary;
    }

    public String getUserFeeDetail() {
        return userFeeDetail;
    }

    public void setUserFeeDetail(String userFeeDetail) {
        this.userFeeDetail = userFeeDetail;
    }

    public String getRefundFeeDetail() {
        return refundFeeDetail;
    }

    public void setRefundFeeDetail(String refundFeeDetail) {
        this.refundFeeDetail = refundFeeDetail;
    }

    public static final class Builder {
        private String id;
        private String title;
        private boolean selected;
        private String personLiable;
        private String userFeeSummary;
        private String userFeeDetail;
        private String refundFeeDetail;

        private Builder() {
        }

        public Builder id(String val) {
            id = val;
            return this;
        }

        public Builder title(String val) {
            title = val;
            return this;
        }

        public Builder selected(boolean val) {
            selected = val;
            return this;
        }

        public Builder personLiable(String val) {
            personLiable = val;
            return this;
        }

        public Builder userFeeSummary(String val) {
            userFeeSummary = val;
            return this;
        }

        public Builder userFeeDetail(String val) {
            userFeeDetail = val;
            return this;
        }

        public Builder refundFeeDetail(String val) {
            refundFeeDetail = val;
            return this;
        }

        public RefundReasonModel build() {
            return new RefundReasonModel(this);
        }
    }
}
